package com.patterns.agent.dynamicagent;

import java.lang.reflect.Proxy;

/**
 * @Author Tanyu
 * @Date 2020/6/2 11:53
 * @Description 生产代理对象的工厂
 * @Version 1.0
 */
public class MyProxyFactory {
  public static Object getProxy(Object target){
    MyInvocationHandle handle=new MyInvocationHandle();
    handle.setTarget(target);
    Object proxy= Proxy.newProxyInstance(target.getClass().getClassLoader(),target.getClass().getInterfaces(),handle);
    return proxy;
  }
}
